package com.it;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

public class _6_5RegisterServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        response.setCharacterEncoding("UTF-8");
        request.setCharacterEncoding("UTF-8");
        //
        String userName=request.getParameter("userName");
        String userPwd=request.getParameter("userPwd");
        String email=request.getParameter("email");
        String userSex=request.getParameter("userSex");
        String userEducation=request.getParameter("userEducation");
        PrintWriter out=response.getWriter();
        out.println("<html>");
        out.println("<head><title>ServletContext</title></head>");
        out.println("<body><br/>");
        out.println("<table border=1 align=left>");
        out.println("<tr><th>参数</th><th>参数值</th></tr>");
        out.println("<tr><td>userName</td><td>"+userName+"</td></tr>");
        out.println("<tr><td>userPwd</td><td>"+userPwd+"</td></tr>");
        out.println("<tr><td>email</td><td>"+email+"</td></tr>");
        out.println("<tr><td>userSex</td><td>"+userSex+"</td></tr>");
        out.println("<tr><td>userEducation</td><td>"+userEducation+"</td></tr>");
        out.println("</table></body>");
        out.println("</html>");
        out.flush();
        out.close();
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}